package com.yanqu.road.server.logic.activity.condition.normal;

import com.yanqu.road.entity.activity.ActivityConditionInfo;
import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.enums.eGamePlayerEventType;
import com.yanqu.road.logic.config.ChannelConfig;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.task.TaskModule;
import com.yanqu.road.server.logic.activity.BaseActivityData;
import com.yanqu.road.server.logic.activity.condition.BaseActivityCondition;
import com.yanqu.road.server.manger.activity.ActivityMgr;
import com.yanqu.road.server.manger.activity.NormalActivityMgr;

public class NewYearBagTalkCondition extends BaseActivityCondition {

    public NewYearBagTalkCondition(ActivityInfo activityInfo, ActivityConditionInfo activityConditionInfo, BaseActivityData baseActivityData) {
        super(activityInfo, activityConditionInfo, baseActivityData);
    }

    @Override
    protected void player_BoardLevelHandle(Object object) {

    }

    @Override
    public void addTrigger(GamePlayer player) {
        player.getModule(TaskModule.class).getGameEvent().addListener(eGamePlayerEventType.NewYearBagTalk.getValue(), handle);
    }

    @Override
    public void removeTrigger(GamePlayer player) {
        player.getModule(TaskModule.class).getGameEvent().removeListener(eGamePlayerEventType.NewYearBagTalk.getValue(), handle);
    }

    public boolean isCompleted(GamePlayer player) {
        if(ChannelConfig.NEW_YEAR_BAG_SWITCH == 0){
            return false;
        }
        if(!ActivityMgr.activityInTime(activityInfo)){
            return false;
        }
        return getValue().compareTo(activityConditionInfo.getParamList().get(3)) >= 0;
    }
}
